package com.haomin.terra_cotta_warriors.repository;


import com.haomin.terra_cotta_warriors.data_object.ParClass;
import com.haomin.terra_cotta_warriors.data_object.SonClass;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface SonClassRepo {

    @Insert("insert into sonclass (pid, sname) values (#{pid}, #{sname})")
    int insertOne(SonClass sonClass);

    @Select("select sid from sonclass where pid = #{pid} and sname = #{sname}")
    int selectSid(int pid, String sname);

    @Select("select sid, sname from sonclass where pid = #{pid} ")
    List<SonClass> selectBiyPid(int pid);

    @Select("select sid, sname from sonclass order by sid ")
    List<SonClass> selectAll();
}
